﻿@using System.Threading.Tasks
@using Microsoft.AspNetCore.Builder
@using Microsoft.AspNetCore.Localization
@using Microsoft.AspNetCore.Mvc.Localization
@using Microsoft.Extensions.Options
@inject IViewLocalizer Localizer
@inject IOptions<RequestLocalizationOptions> LocOptions

@{
    var requestCulture = Context.Features.Get<IRequestCultureFeature>();
    var cultureItems = LocOptions.Value.SupportedUICultures
        .Select(c => new SelectListItem { Value = c.Name, Text = c.DisplayName })
        .ToList();
}
<li class="nav-item dropdown">
    <a class="nav-link" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
        <i class="fa fa-2x fa-globe"></i>
    </a>
    <div class="dropdown-menu dropdown-menu-right dropdown-menu-lg">
        <div class="dropdown-header text-center">
            <strong>@Localizer["Title-Available-Languages"]</strong>
        </div>
        <a asp-controller="Home" asp-action="SetLanguage" asp-route-culture="pt-BR" class="dropdown-item">
            <i class="flag-icon flag-icon-br"></i> Portuguese (Brazil)
        </a>
        <a asp-controller="Home" asp-action="SetLanguage" asp-route-culture="en" class="dropdown-item">
            <i class="flag-icon flag-icon-us"></i> English
        </a>

        <a asp-controller="Home" asp-action="SetLanguage" asp-route-culture="el-GR" class="dropdown-item">
            <i class="flag-icon flag-icon-gr"></i> Greek
        </a>

        <a asp-controller="Home" asp-action="SetLanguage" asp-route-culture="es" class="dropdown-item">
            <i class="flag-icon flag-icon-es"></i> Spanish
        </a>
        <a asp-controller="Home" asp-action="SetLanguage" asp-route-culture="fr" class="dropdown-item">
            <i class="flag-icon flag-icon-fr"></i> French
        </a>
        <a asp-controller="Home" asp-action="SetLanguage" asp-route-culture="nl" class="dropdown-item">
            <i class="flag-icon flag-icon-nl"></i> Dutch
        </a>
        <a asp-controller="Home" asp-action="SetLanguage" asp-route-culture="ru" class="dropdown-item">
            <i class="flag-icon flag-icon-ru"></i> Russian
        </a>
        <a asp-controller="Home" asp-action="SetLanguage" asp-route-culture="zh-cn" class="dropdown-item">
            <i class="flag-icon flag-icon-cn"></i> Chinese Simplified
        </a>
        <a asp-controller="Home" asp-action="SetLanguage" asp-route-culture="zh-tw" class="dropdown-item">
            <i class="flag-icon flag-icon-cn"></i> Chinese Traditional
        </a>
    </div>
</li>